/**
 * Created by wenguangjia on 2017/6/14.
 */
(function () {
    'use strict';

    angular
        .module('logcenterApp')
        .config(stateConfig);

    stateConfig.$inject = ['$stateProvider'];

    function stateConfig($stateProvider) {
        $stateProvider
            .state('partitionDash', {
                parent: 'app',
                url: '/log/partitionDash',
                data: {
                    authorities: ['ROLE_USER']
                },
                views: {
                    'content@': {
                        templateUrl: 'app/dashboard/partitionDash/partitionDash.html',
                        controller: 'partitionDashController',
                        controllerAs: 'vm'
                    }
                },
                resolve: {
                    translatePartialLoader: ['$translate', '$translatePartialLoader', function ($translate, $translatePartialLoader) {
                        $translatePartialLoader.addPart('global');
                        return $translate.refresh();
                    }],
                    isMulti:getIsMulti,
                    kibanaPartition:getKibanaPartition
                }
            })
            .state('platformDash', {
                parent: 'app',
                url: '/log/platformDash',
                data: {
                    authorities: ['ROLE_USER']
                },
                views: {
                    'content@': {
                        templateUrl: 'app/dashboard/platformDash/platformDash.html',
                        controller: 'platformDashController',
                        controllerAs: 'vm'
                    }
                },
                resolve: {
                    translatePartialLoader: ['$translate', '$translatePartialLoader', function ($translate, $translatePartialLoader) {
                        $translatePartialLoader.addPart('global');
                        return $translate.refresh();
                    }],
                    isMulti:getIsMulti,
                    kibanaPartition:getKibanaPartition
                }
            })
            .state('questioncount', {
                parent: 'app',
                url: '/log/questioncount',
                data: {
                    authorities: ['ROLE_USER']
                },
                views: {
                    'content@': {
                        templateUrl: 'app/dashboard/questionCount/questionCount.html',
                        controller: 'questionCountController',
                        controllerAs: 'vm'
                    }
                },
                resolve: {
                    translatePartialLoader: ['$translate', '$translatePartialLoader', function ($translate, $translatePartialLoader) {
                        $translatePartialLoader.addPart('global');
                        return $translate.refresh();
                    }],
                    isMulti:getIsMulti,
                    kibanaPartition:getKibanaPartition
                }
            })
            .state('transfercount', {
                parent: 'app',
                url: '/log/transfercount',
                data: {
                    authorities: ['ROLE_USER']
                },
                views: {
                    'content@': {
                        templateUrl: 'app/dashboard/transferCount/transferCount.html',
                        controller: 'transferCountController',
                        controllerAs: 'vm'
                    }
                },
                resolve: {
                    translatePartialLoader: ['$translate', '$translatePartialLoader', function ($translate, $translatePartialLoader) {
                        $translatePartialLoader.addPart('global');
                        return $translate.refresh();
                    }],
                    isMulti:getIsMulti,
                    kibanaPartition:getKibanaPartition
                }
            })
            .state('deploydash', {
                parent: 'app',
                url: '/log/deploydash',
                data: {
                    authorities: ['ROLE_USER']
                },
                views: {
                    'content@': {
                        templateUrl: 'app/dashboard/deployDash/deployDash.html',
                        controller: 'deployDashController',
                        controllerAs: 'vm'
                    }
                },
                resolve: {
                    translatePartialLoader: ['$translate', '$translatePartialLoader', function ($translate, $translatePartialLoader) {
                        $translatePartialLoader.addPart('global');
                        return $translate.refresh();
                    }],
                    isMulti:getIsMulti,
                    kibanaPartition:getKibanaPartition
                }
            })
            .state('svcanalysis', {
                parent: 'app',
                url: '/log/svcanalysis',
                data: {
                    authorities: ['ROLE_USER']
                },
                views: {
                    'content@': {
                        templateUrl: 'app/dashboard/svcAnalysis/svcAnalysis.html',
                        controller: 'svcAnalysisController',
                        controllerAs: 'vm'
                    }
                },
                resolve: {
                    translatePartialLoader: ['$translate', '$translatePartialLoader', function ($translate, $translatePartialLoader) {
                        $translatePartialLoader.addPart('global');
                        return $translate.refresh();
                    }]
                }
            })

    }
    getIsMulti.$inject=['PropertiesService'];
    function getIsMulti(PropertiesService) {
        return PropertiesService.getProperties().then(function (promiseValue) {
            return promiseValue.isMulti;
        });
    }

    getKibanaPartition.$inject=['PropertiesService'];
    function getKibanaPartition(PropertiesService) {
        return PropertiesService.getProperties().then(function (promiseValue) {
            return promiseValue.kibanaPartition;
        });
    }

})();

